<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="./general-styles-of-descendant-components.css"
    />
  </head>
  <body>
    <div id="root"></div>
    <script src="https://cdn.bootcdn.net/ajax/libs/react/17.0.1/umd/react.development.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-dom/17.0.1/umd/react-dom.development.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.7.2/prop-types.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/Mock.js/1.0.0/mock-min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-router-dom/5.2.0/react-router-dom.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/redux/4.0.5/redux.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-redux/7.2.2/react-redux.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/redux-thunk/2.3.0/redux-thunk.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/react-transition-group/4.4.1/react-transition-group.min.js"></script>
    <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
    <script type="text/babel">
      const { Component, Fragment } = React;
      function App() {
        return (
          <Fragment>
            <Parent />
          </Fragment>
        );
      }
      class Parent extends Component {
        render() {
          return (
            <div className="Parent">
              <h3>我是Parent组件</h3>
              <A render={(name) => <B name={name} />} />
            </div>
          );
        }
      }
      class A extends Component {
        state = {
          name: "tom",
        };
        render() {
          const { name } = this.state;
          return (
            <div className="A">
              <h3>我是A组件</h3>
              {this.props.render(name)}
            </div>
          );
        }
      }
      class B extends Component {
        render() {
          return (
            <div className="B">
              <h3>我是B组件,{this.props.name}</h3>
            </div>
          );
        }
      }
      ReactDOM.render(<App />, document.getElementById("root"));
    </script>
  </body>
</html>
